﻿using System;
using System.Diagnostics;
using System.Globalization;
using System.Runtime.Serialization;

namespace CSC.Google
{
    /// <summary>
    /// Localized Page Speed results. Contains a ruleResults entry for each Page Speed rule instantiated and run by the server.
    /// </summary>
    [Serializable]
    public class FormattedResults
    {
        #region Private Variables
        [OptionalField, DebuggerBrowsable(DebuggerBrowsableState.Never)]
        private string locale = string.Empty;
        [OptionalField, DebuggerBrowsable(DebuggerBrowsableState.Never)]
        private RuleResults ruleResults = null;
        #endregion

        /// <summary>
        /// The locale of the formattedResults, such as "en".
        /// </summary>
        public CultureInfo Locale { get { return new CultureInfo(locale.Replace("fil", "fil-PH").Replace("iw", "he").Replace('_','-')); } }

        /// <summary>
        /// Dictionary of formatted rule results, with one entry for each Page Speed rule instantiated and run by the server.
        /// </summary>
        public RuleResults RuleResults { get { return ruleResults; } }
    }
}
